<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.sbl.bajw.pc.model.DeptModel"%>
<%@page import="com.sbl.bajw.pc.model.CameraHouseModel"%>
<%@page import="com.sbl.bajw.pc.model.CameraModel"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../../common/prama.jsp" %>
<%
List<HashMap<String,String>> pics = (List<HashMap<String,String>>)request.getAttribute("pics");
    CameraHouseModel model = (CameraHouseModel)request.getAttribute("model");
    List<DeptModel> polices = (List<DeptModel>)request.getAttribute("polices");
    List<DeptModel> communitys = (List<DeptModel>)request.getAttribute("communitys");
    String installDate = "";
    if(model.getInstallDate() != null){
    	SimpleDateFormat df = new SimpleDateFormat("yyyy-M-dd");
    	installDate = df.format(model.getInstallDate());
    }
%>
<script type="text/javascript" src="${burl }/js/business/manager/CameraHouseMain.js"></script>
<div class="CommonPanel" id="dataForm">
	<input type="hidden" id="model_id" value="${model.id }"/>
	<div style="float:left;width:200px;height:200px;overflow: hidden;position: relative;">
		<div id="picContentDiv" style="width:<%=200*pics.size()%>px;position: absolute;left:0">
		<%
			for(int i = 0 ;i<pics.size();i++){
				String imgUrl = BaseUrl +"/"+ pics.get(i).get("SMALLIMGURL");
			%>
			<img width="200" style="float:left" src="<%=imgUrl%>"/>
			
			<%
			}
		%>
		</div>
		<img id="preBtn" style="position: absolute;left: 0;top: 50%;cursor: pointer;" src="${burl }/images/camera/picArrowLeft.png"/>
		<img id="nextBtn" style="position: absolute;right: 0;top: 50%;cursor: pointer;" src="${burl }/images/camera/picArrowRight.png"/>
	</div>
	<table style="float:left;">
		<tr>
			<td class="label">名称:</td>
			<td class="input">
				<input name='name' value="${model.name }"/>
			</td>
			<td class="label">派出所:</td>
			<td class="input">
				<select name="policeStation" id="policeStation">
				<%
					for(int i=0;i<polices.size();i++){
						DeptModel dmodel = polices.get(i);
						String did = dmodel.getId();
						String name = dmodel.getDeptname();
						String selected = did.equals(model.getPoliceStation())?"selected":"";
					%>
					<option <%=selected %> value="<%=did%>"><%=name %></option>
					<%
					}
				%>
				</select>
				
			</td>
			<td class="label">社区:</td>
			<td class="input">
				<select name="community" id="community">
					<%
						for(int i=0;i<communitys.size();i++){
							DeptModel dmodel = communitys.get(i);
							String did = dmodel.getId();
							String name = dmodel.getDeptname();
							String selected = did.equals(model.getCommunity())?"selected":"";
							%>
							<option <%=selected %> value="<%=did%>"><%=name %></option>
							<%
						}
					%>
				</select>
			</td>
			<td class="label"></td>
			<td class="input">
			</td>
		</tr>
		<tr>
			<td class="label">安装时间:</td>
			<td class="input">
				<input datatype="date" name="installDate" value="<%=installDate%>"/>
			</td>
			<td class="label">监控员持岗上岗人数:</td>
			<td class="input">
				<input name="watchManNum" value="${model.watchManNum }"/>
			</td>
			<td class="label">楼栋编码:</td>
			<td class="input">
				<input name="buildingCode" value="<%=model.getBuildingCode() %>" /> 
			</td>
		</tr>
		<tr>
			<td class="label">负责人:</td>
			<td class="input">
				<input name="chargeMan" value="${model.chargeMan }"/>
			</td>
			<td class="label">联系电话:</td>
			<td class="input">
				<input name="phone" value="${model.phone }"/>
			</td>
			<td class="label">摄像头数量:</td>
			<td class="input">
				<input name="cameraNum" value="${model.cameraNum }"/>
			</td>
			<td class="label"></td>
			<td class="input">
			</td>
		</tr>
		<tr>
			<td class="label">地址:</td>
			<td class="input">
				<input id="address" name="address" value="${model.address }"/>
			</td>
		</tr>
	</table>
	<input id="lat" name="lat" type="hidden" value="${model.lat }"/>
	<input id="id" name="id" type="hidden" value="${model.id }"/>
	<input id="lon" name="lon" type="hidden" value="${model.lon }"/>
	<input id=parentMenu type="hidden" value="/CameraHouse/List.do"/>
	<div style="clear: both;margin-bottom: 4px"></div>
	<div id="bmap" style="height: 270px;width: 100%;"></div>
	<div style="text-align: center;">
		<button class="commonBtn" style="font-size: 20px" id="saveBtn">保存</button>
		<button class="commonBtn" style="font-size: 20px" onclick="window.close()">关闭</button>
	</div>
</div>